<?php

class systemDebug {
	private $lbDebug;
	private $lsFileName;

	private function write($isText) {
		$ldDate = new DateTime();
		$lsDate = $ldDate->format('d.m.Y H:i:s');

		$lfFile = fopen("./logs/".$this->lsFileName, "a");
		fwrite($lfFile, $lsDate.": ".$isText."\r\n");
		fclose($lfFile);
	}

	public function __construct($ibDbgEnable, $isFileName) {
		$this->lbDebug = $ibDbgEnable;
		$this->lsFileName = $isFileName;
	}

	public function pl($text) {
		if($this->lbDebug) {
			$this->write($text);
		}
	}

	public function vl($var, $value) {
		if($this->lbDebug) {
			$this->write($var." = ".$value);
		}
	}
}